Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate upgrade using moved blocks #81

Merged
merged 7 commits into from
Oct 23, 2022
Merged

Automate upgrade using moved blocks #81

merged 7 commits into from
Oct 23, 2022

Conversation

Nuru
Copy link
Contributor

@Nuru Nuru commented Oct 22, 2022

Important Notes

  • Terraform version 1.3.0 and Terraform AWS version 4.9.0 or later are required
  • You can now select default values for (non-deprecated) inputs by setting them to null
  • With Terraform 1.3 the manual interventions documented for upgrading to this module's versions 0.27.0 and 0.28.0 are no longer needed. You can safely upgrade from any earlier version to this one (although we always recommend leaving force_destroy at its default value of false, and if you have it set to true but want extra safety against the S3 bucket being destroyed, set it to false before upgrading).
  • The force_destroy_enabled flag introduced in v0.27.0 has been removed
  • In version 0.28.0, old lifecycle rule variables were deprecated and the new lifecycle_configuration_rules input was introduced. In that version, you would continue to get the old default lifecycle rule even if you supplied new rules via lifecycle_configuration_rules. Now, the default behavior is to ignore all the deprecated lifecycle inputs when the lifecycle_configuration_rules input is not empty, unless you explicitly set lifecycle_rule_enabled to true.

what

  • Automate the upgrade process from v0.26.0 or earlier by using moved block functionality introduced in Terraform 1.3.0
  • Add nullable = false for module input variables which have a default value and where null is not a sensible/handled value for the variable.

why

@Nuru Nuru added the major Breaking changes (or first stable release) label Oct 22, 2022
@Nuru Nuru requested review from a team as code owners October 22, 2022 22:43
@Nuru
Copy link
Contributor Author

Nuru commented Oct 22, 2022

/test all

main.tf Outdated Show resolved Hide resolved
aknysh
aknysh previously approved these changes Oct 22, 2022
main.tf Outdated Show resolved Hide resolved
nitrocode
nitrocode previously approved these changes Oct 22, 2022
@Nuru Nuru dismissed stale reviews from nitrocode and aknysh via ebce8a1 October 23, 2022 00:02
@Nuru Nuru requested review from aknysh and nitrocode October 23, 2022 00:06
@Nuru
Copy link
Contributor Author

Nuru commented Oct 23, 2022

/test all

nitrocode
nitrocode previously approved these changes Oct 23, 2022
@Nuru Nuru enabled auto-merge (squash) October 23, 2022 00:26
@Nuru
Copy link
Contributor Author

Nuru commented Oct 23, 2022

/test all

@Nuru Nuru disabled auto-merge October 23, 2022 00:31
@Nuru Nuru dismissed nitrocode’s stale review October 23, 2022 00:33

More changes coming

@Nuru Nuru marked this pull request as draft October 23, 2022 00:35
@Nuru Nuru marked this pull request as ready for review October 23, 2022 03:43
@Nuru Nuru requested a review from nitrocode October 23, 2022 03:43
@Nuru
Copy link
Contributor Author

Nuru commented Oct 23, 2022

/test all

}



locals {
deprecated_lifecycle_rule = {
enabled = var.lifecycle_rule_enabled
enabled = var.lifecycle_rule_enabled == true || (var.lifecycle_rule_enabled == null && length(var.lifecycle_configuration_rules) == 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enabled = var.lifecycle_rule_enabled == true || (var.lifecycle_rule_enabled == null && length(var.lifecycle_configuration_rules) == 0)
enabled = var.lifecycle_rule_enabled || (var.lifecycle_rule_enabled == null && length(var.lifecycle_configuration_rules) == 0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nitrocode

│ Error: Operation failed
│ 
│   on variables-deprecated.tf line 82, in locals:
│    82:   enabled = var.lifecycle_rule_enabled || (var.lifecycle_rule_enabled == null && length(var.lifecycle_configuration_rules) == 0)
│      ├────────────────
│      │ var.lifecycle_rule_enabled is null
│ 
│ Error during operation: argument must not be null.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah interesting, I didn't realize if a var type = bool that defaulted to null wouldn't already implicitly resolve to false. Good to know.

@Nuru Nuru merged commit bcb1b1b into master Oct 23, 2022
@Nuru Nuru deleted the tf-moved branch October 23, 2022 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Breaking changes (or first stable release)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support nullable flag for variables with default values
3 participants